/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kks;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import static java.awt.image.ImageObserver.WIDTH;
import java.text.NumberFormat;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author basti
 */
public class TicketFrame extends JFrame
{
    private cBooking Booking;
    private JLabel lblMovieName;
    private JLabel lblPic;
    private JFormattedTextField txtPrice;
    private JLabel lblRoom;
    
    public TicketFrame(cBooking booking)
    {
        setBackground(CustomColors.BackgroundLight);
        setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));      
        Booking = booking;               
        initComps();
        
        setSize(185, 450);
        setLocationRelativeTo(null);
        setVisible(true);        
    }
    
    private void initComps()
    {
        //pnlOne = new JPanel(new GridLayout(1,0));
        //pnlTwo = new JPanel(new GridLayout(4,0));
        lblPic = new JLabel(new ImageIcon(getClass().getResource("/images/poster/"+Booking.getMovieName()+".jpg")));
        JLabel lblPicLogo = new JLabel(new ImageIcon(getClass().getResource("/images/icons/logo.jpg")));
        
        lblMovieName = new JLabel(String.valueOf(Booking.getQuantity()) + " x " + Booking.getMovieName());
        lblMovieName.setFont(CustomFonts.FontSubline);
        lblRoom = new JLabel("Room: " + String.valueOf(Booking.getMovie().getMovieRoom()));
        
        NumberFormat paymentFormat = NumberFormat.getCurrencyInstance();
        
        txtPrice = new JFormattedTextField(paymentFormat);
        txtPrice.setEditable(false);
        txtPrice.setText(Booking.getMovie().getPriceString());
        
        add(lblPicLogo);
        add(lblPic);
        add(lblMovieName);
        add(lblRoom);
        add(txtPrice);
        
        
        pack();
    }
}
